package com.csun.cmny.provider.device.watch.entity;

    /// <summary>
    ///  下行服务中心配置数据组包
    ///  关联上行确认 043
    ///  Down service center configuration data package
    ///  Associated upstream confirmation 043
    /// </summary>
    public class C042
    {
        /// <summary>
        /// 数据起封包 @B#@ 
        /// Start Fixed value :@B#@ 
        /// </summary>
        public String HeadCode = "@B#@";
        /// <summary>
        /// 协议版本号
        /// Protocol version number
        /// </summary>
        public String Protocol = null;
        /// <summary>
        /// 功能代码识别
        /// Function code
        /// </summary>
        public final String FunCode = "042";
        /// <summary>
        /// 国际移动设备身份码
        /// International Mobile Equipment Identity
        /// </summary>
        public String IMEI = null;
        /// <summary>
        /// 心率上传周期  0-300 分
        /// Heart rate upload period 0-300 points
        /// </summary>
        public int BatCycle =0;
        /// <summary>
        /// GPS上传周期  0-300 分
        /// GPS upload period 0-300 points
        /// </summary>
        public int GPSCycle =0;
        /// <summary>
        /// GPS静默时间段设置  07002200
        /// GPS silent time setting 07002200
        /// </summary>
        public int GPSOff =0;
        /// <summary>
        /// 余额提醒时间段设置  07002200
        /// Balance reminder period setting 07002200
        /// </summary>
        public String YeTime = null;
        /// <summary>
        /// 低电提醒时间段设置  07002200
        /// Low reminder period setting 07002200
        /// </summary>
        public String LowpTime = null;
        /// <summary>
        /// GPS开关设置  0关闭  1开启
        /// GPS switch settings 0 off 1 on
        /// </summary>
        public int IsGPS =0;
        /// <summary>
        /// 白名单开关设置  0关闭  1开启
        /// White list switch setting 0 off 1 on
        /// </summary>
        public int IsBmd =0;
        /// <summary>
        /// 白名单   号码&号码
        /// White list number & number
        /// </summary>
        public String Bmd = null;
        /// <summary>
        /// 余额短信查询   接收号码&短信
        /// Balance SMS inquiry     Receive number & SMS
        /// </summary>
        public String YeSms = null;
        /// <summary>
        /// 音量等级 0-11
        /// Volume Level 0-11
        /// </summary>
        public int Voice =0;
        /// <summary>
        /// 心率范围  50&150
        /// Heart rate range 50&150
        /// </summary>
        public int BatFanWei =0;
        /// <summary>
        /// 红色号码
        /// Red number
        /// </summary>
        public String RMobile = null;
        /// <summary>
        /// 黄色号码
        /// Yellow number
        /// </summary>
        public String YMobile = null;
        /// <summary>
        /// 绿色号码
        /// Green number
        /// </summary>
        public String GMobile= null;
        /// <summary>
        /// 0：不升级，1升级
        /// 0: No upgrade, 1 upgrade
        /// </summary>
        public int UpdateV = 0;
        /// <summary>
        /// 终端当前时间(年月日时分秒) yyyyMMddHHmmss
        /// The terminal current time ( format:yyyyMMddHHmmss)
        /// </summary>
        public String TerminalTime = null;
        /// <summary>
        /// 结尾封包 @E#@
        /// End packet @E#@
        /// </summary>
        public String FootCode = "@E#@";




        /// <summary>
        /// 初始化模型
        ///@B#@|01|042|111112222233333|5|10|00002359|00002300|01001800|1|1|132 45225552&15223636632|10086&\u0031\u0030\u0032|7|45&150|1362215222
         ///2|15962225212|17052225452|0|20160729174051|@E#@
        /// </summary>
        /// <param name="cmdStr">命令代码</param>
        public C042(String cmdStr)
        {
        	String[] data = cmdStr.split("\\|");
            int dataLength = data.length;
            if (dataLength == 21 && "@B#@".equals(data[0]) && FunCode.equals(data[2]))
            {
                HeadCode = data[0];
                Protocol = data[1];
                IMEI = data[3];
                BatCycle = Integer.parseInt(data[4]);
                GPSCycle = Integer.parseInt(data[5]);
                GPSOff = Integer.parseInt(data[6]);
                YeTime = data[7];
                LowpTime = data[8];
                IsGPS = Integer.parseInt(data[9]);
                IsBmd = Integer.parseInt(data[10]);
                Bmd = data[11];
                YeSms = data[12];
                Voice = Integer.parseInt(data[13]);
                BatFanWei = Integer.parseInt(data[14]);
                RMobile = data[15];
                YMobile = data[16];
                GMobile = data[17];
                UpdateV = Integer.parseInt(data[18]);
                TerminalTime = data[19];
                FootCode = data[20];
            }

        }

        public  String ToString()
        {
        	String rString = HeadCode + "|";
            rString += Protocol + "|";
            rString += FunCode + "|";
            rString += IMEI + "|";
            rString += BatCycle + "|" + GPSCycle + "|" + GPSOff + "|" + YeTime + "|" + LowpTime + "|" + IsGPS + "|" +
                IsBmd + "|" + Bmd + "|" + YeSms + "|" + Voice + "|" +
                BatFanWei + "|" + RMobile + "|" + YMobile + "|" + GMobile + "|" + UpdateV + "|";


            rString += TerminalTime + "|";
            rString += FootCode;
            return rString;
        }
    }




